def get_prior_p(x, ds, label):  # 返回单个属性的P
    p_list = []
    for a in list(set(ds[label].tolist())):  # 遍历label的每个唯一属性

        count_a = len(ds[ds[label] == a])
        lens = len(ds.values)
        p_x = 1
        for b in x:  # 遍历数据
            b_count = len(ds[(ds[b[0]] == b[1]) & (ds[label] == a)])
            p_x *= b_count / count_a

        p = round(count_a / lens * p_x, 3)
        p_list.append([a, p])

    return p_list
